package com.mxpio.erp.common.hr.entity;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpio.erp.common.jpa.policy.ResCodeGeneratorPolicy;
import com.mxpioframework.filestorage.entity.MxpioFileInfo;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_HR_CONTRACT")
@Schema(description="员工合同")
public class Contract extends BaseEntity {

    @Id
    @Column(name = "BIZ_NO_", updatable = false)
    @Generator(policy = ResCodeGeneratorPolicy.class)
    @Schema(description = "合同编号")
    private String bizNo;

    @Column(name = "NAME_CODE_", length = 64)
    @Schema(description = "员工账号")
    @Dict(dicCode = "nameCode", dicEntity = Employee.class, dicText = "name")
    private String nameCode;

    @Column(name = "DATE_START_CONTRACT_")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @Schema(description = "合同开始日期")
    private Date dateStartContract;

    @Column(name = "DATE_END_CONTRACT_")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @Schema(description = "合同结束日期")
    private Date dateEndContract;

    @Column(name = "FILE_NO_")
    @Schema(description = "附件")
    @Dict(dicCode = "fileNo", dicEntity = MxpioFileInfo.class, dicText = "fileName")
    private String fileNo;

}
